package com.example.WebSocketDemo.web;

import com.example.WebSocketDemo.service.RecentMessageService;
import com.example.WebSocketDemo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RecentMessageController {
    @Autowired
    private RecentMessageService recentMessageService;

    @GetMapping("/recent")
    public Result getMessage(String username){
        return Result.success(recentMessageService.getRecentMessageByUserName(username));
    }
}
